#
#	Microsoft nmake Makefile for BLACC
#
#

ANALYZE=/analyze:only
DEBUGALL=/RTC1 /MDd /DMEMDEBUG

#CPPFLAGS=/Zi /W4 /D_HAS_EXCEPTIONS=0 /D_CRT_SECURE_NO_DEPRECATE /nologo /GF /TP /GS- /EHs-c- /RTCu
CPPFLAGS=/Zi /W4  /D_CRT_SECURE_NO_DEPRECATE /nologo /GF /TP /GS- $(DEBUGALL) /EHsc $(ANALYZE)

#OBJDIR  =obj
EXENAME =blacc

STRS	=eng/blaccerr.str

OBJS    =main.obj common.obj globals.obj file.obj error.obj token.obj filesys.obj parse.obj symbol.obj
SRC     =main.cpp common.cpp globals.cpp file.cpp error.cpp token.cpp filesys.cpp parse.cpp symbol.cpp
# symbol.obj common.obj symtab.obj input.obj parse.obj \
# check.obj compute.obj operator.obj loadfile.obj generate.obj map.obj \
#  gen_c.obj html.obj memwatch.obj bitset.obj #lr0.obj
# gen_c.obj


LNLIBS  =

all             : cstr $(EXENAME) TAGS

main.obj 		: common.h file.h token.h
common.obj		: common.h
error.obj		: token.h
file.obj 		: common.h file.h
filesys.obj		: token.h
globals.obj 	: common.h token.h
#lex.obj			: common.h file.h lex.h
token.obj		: token.h
parse.obj		: token.h symbol.h
symbol.obj		: symbol.h

# I'm using Gnu Global to maintain tags for Gnu Emacs
TAGS : *.cpp *.h *.str
    gtags

cstr            : cstr.exe

cstr.exe : cstr.obj


$(EXENAME)      : $(EXENAME).exe
	if exist memwatch.log del memwatch.log

regress     : regress.exe

#regress.exe : $(OBJDIR)\regress.exe
#        copy $(OBJDIR)\regress.exe .

regress.exe : regress.obj


main.obj check.obj compute.obj : check.h
$(OBJS) : common.h
main.obj compute.obj : compute.h
main.obj error.obj token.obj filesys.obj : error.h
filesys.obj : filedata.cpp
filesys.obj token.obj : filesys.h
generate.obj gen_c.obj : generate.h
input.obj : input.h
main.obj check.obj compute.obj operator.obj parse.obj : parse.h
main.obj check.obj common.obj compute.obj generate.obj gen_c.obj html.obj lr0.obj operator.obj parse.obj symtab.obj  : symtab.h input.h

$(EXENAME).exe    : $(OBJS)
	link /DEBUG /out:$(EXENAME).exe $(OBJS)

gen_c.obj       : gen_ctmp.c

html.obj		: htmlform.c

filedata.cpp    : $(STRS) cstr
    cstr $(STRS) >filedata.cpp

htmlform.c		: htmlform.str cstr.exe
    cstr htmlform.str
gen_ctmp.c      : gen_ctmp.str cstr.exe
    cstr gen_ctmp.str


clean           :
                del $(OBJDIR)\*.obj $(OBJDIR)\*.pdb $(OBJDIR)\*.ilk *.map *.out *.not *.ndx *.exe *.com *.bak *.lst *.tmp *.obj *.ilk *.pdb

